import scrapy
from selenium import webdriver
from selenium.webdriver.firefox.webdriver import Options
from boss.proxy_boss import ProxyMiddleware


class BossproSpider(scrapy.Spider):
    name = 'bosspro'
    allowed_domains = ['zhipin.com']
    start_urls = ['https://www.zhipin.com/c100010000/?query=python&page=2&ka=page-2']




    def __init__(self):
        self.proxie=ProxyMiddleware()
        self.proxies=self.proxie.ip
        print(self.proxies)
        self.opt=Options()
        #self.opt.add_argument('--headless')
        self.opt.add_argument('--disable-gpu')
        self.opt.add_argument(self.proxies)
        self.bro=webdriver.Firefox(firefox_options=self.opt)

    def parse(self, response):
        print(response)
        # prowor_title=response.xpath('//*[@id="main"]/div/div[2]/ul/li[1]/div/div[1]/div[1]/div/div[1]/span[2]/span/text()').extract_first()
        # print(prowor_title)
        # for net_title in prowor_title:
        #     net_title_href=net_title.xpath('./div/div[1]/div[1]/div/@href').extract_first()
        #     net_title_money=net_title.xpath('./div/div[1]/div[1]/div/div[2]/span/text()').extract_first()
        #     print(net_title_href,net_title_money)


    def __del__(self,spider):
        self.bro.quit()


